package com.tpyule.tpclass.util.FileUpload;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.internal.OSSHeaders;
import com.aliyun.oss.model.CannedAccessControlList;
import com.aliyun.oss.model.ObjectMetadata;
import com.aliyun.oss.model.PutObjectRequest;
import com.aliyun.oss.model.StorageClass;

/**
 * @author zzz
 * @version 1.0
 * @date 2020/3/26 23:56
 */
public class BaseUpload {
    private String endpoint="cdn.404zz.cn";
    private String accessKeyId="LTAI4Fbz6rZcSTb7aHxv38cW";
    private String accessKeySecret="WrdEj5QuXRAHvOF5iQ1muXLxhZ2HQe";
    private OSS ossClient ;
    private PutObjectRequest putObjectRequest;
    private ObjectMetadata metadata ;

    public BaseUpload () {
        ossClient = new OSSClientBuilder().build(endpoint,accessKeyId,accessKeySecret);
        metadata = new ObjectMetadata();
        metadata.setHeader(OSSHeaders.OSS_STORAGE_CLASS, StorageClass.Standard.toString());
        metadata.setObjectAcl(CannedAccessControlList.PublicRead);
    }

    public String getEndpoint() {
        return endpoint;
    }

    public void setEndpoint(String endpoint) {
        this.endpoint = endpoint;
    }

    public String getAccessKeyId() {
        return accessKeyId;
    }

    public void setAccessKeyId(String accessKeyId) {
        this.accessKeyId = accessKeyId;
    }

    public String getAccessKeySecret() {
        return accessKeySecret;
    }

    public void setAccessKeySecret(String accessKeySecret) {
        this.accessKeySecret = accessKeySecret;
    }

    public OSS getOssClient() {
        return ossClient;
    }

    public void setOssClient(OSS ossClient) {
        this.ossClient = ossClient;
    }

    public PutObjectRequest getPutObjectRequest() {
        return putObjectRequest;
    }

    public void setPutObjectRequest(PutObjectRequest putObjectRequest) {
        this.putObjectRequest = putObjectRequest;
    }

    public ObjectMetadata getMetadata() {
        return metadata;
    }

    public void setMetadata(ObjectMetadata metadata) {
        this.metadata = metadata;
    }
}
